/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package combomodel.servico;

import eloma.classe.servico.ServicoCategoria;
import java.util.List;
import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;

/**
 *
 * @author Icaro
 */
public class ComboBoxServicoCategoriaModel extends AbstractListModel implements ComboBoxModel {

    private List<ServicoCategoria> listaServicoCategoria;
    private ServicoCategoria selection;

    public ComboBoxServicoCategoriaModel(List<ServicoCategoria> listaServicoCategoria) {
        this.listaServicoCategoria = listaServicoCategoria;
    }

    @Override
    public int getSize() {
        return listaServicoCategoria.size();
    }

    @Override
    public ServicoCategoria getElementAt(int index) {
        return listaServicoCategoria.get(index);
    }

    @Override
    public void setSelectedItem(Object anItem) {
        selection = (ServicoCategoria) anItem;
    }

    @Override
    public Object getSelectedItem() {
        return selection;
    }

}
